#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <limits.h>
#include <ctype.h>

int
mystrcmp(const char *s1, const char *s2)
{
	register int i = 0;

	while (s1[i] && s2[i]) {
		if (s1[i] == s2[i]) {
			i++;
			continue;
		}

		if (tolower(s1[i]) != tolower(s2[i]))
			return tolower(s1[i]) - tolower(s2[i]);
		else/* if (s1 < s2)*/
			return s1[i] - s2[i];
	}

	return 0;
}

int
main(int argc, char **argv)
{
	static char word[302];
	static char min[302];
	int n, i = 0;

	(void) fgets(word, 301, stdin);
	sscanf(word, "%d", &n);
	while (i < n) {
		(void) fgets(word, 301, stdin);
		if (strlen(min) == 0)
			strcpy(min, word);
		if (mystrcmp(word, min) < 0)
			strcpy(min, word);
		i++;
	}

	printf("%s", min);

	return 0;
}
